package com.info.log;

import android.R.integer;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

public class InfoLogActivity extends Activity implements OnClickListener, OnItemSelectedListener{
	
	EditText Fname, ht;
	DatePicker bd;
	Button submit;
	String name, BirthDay,HomeTown, Final, BirthDay1, BirthDay2;
	int [] Input = {R.id.Fname, R.id.ht, R.id.bd,R.id.spinner1};
	Spinner sPin;


	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		sPin =(Spinner) findViewById(R.id.spinner1);
		Fname = (EditText) findViewById(R.id.Fname);
		bd = (DatePicker) findViewById(R.id.bd);
		ht = (EditText) findViewById(R.id.ht);
		submit = (Button) findViewById(R.id.sb);
		submit.setOnClickListener(this);
		sPin.setOnItemSelectedListener(this);
		
		ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.aRay,android.R.layout.simple_spinner_item );	
	sPin.setAdapter(adapter);
	
	
	}

	public void onClick(View v) {
		if(v.equals(submit)){
			name = Fname.getText()+"";
			BirthDay = bd.getDayOfMonth()+ "/";
			BirthDay1 = bd.getMonth() + "/";
			BirthDay2 = Integer.toString(bd.getYear() + 1) + 1;
			
			HomeTown = ht.getText()+"";
		
			Final = (name + "\n" + HomeTown + "\n" + BirthDay1  +BirthDay  + BirthDay2 + "\n" + sPin.getSelectedItem().toString());
			Toast.makeText(this, Final, Toast.LENGTH_LONG).show();
			
		}

	}

	public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
			long arg3) {
		Toast.makeText(this, "You have changed something", Toast.LENGTH_LONG).show();
		
	}

	public void onNothingSelected(AdapterView<?> arg0) {
		// TODO Auto-generated method stub
		
	}
}